Macromedia Pollster 2.0
What Is Macromedia Pollster 2.0?
Macromedia Pollster 2.0 is the second version of a hybrid application built in ColdFusion and Macromedia Flash that easily lets you create and deploy polls and polling results to your website. Pollster consists of a ColdFusion-based administration interface for managing polls and a Flash movie that users interact with to submit answers and view poll results.
What's New in Version 2.0?
Macromedia Pollster 2.0 is the new generation of the Pollster application that originally appeared on DevNet Resource Kit (DRK) Volume 4. We received many compliments on Pollster and also many feature requests, which is why we decided to release a second version.
Below are some of the new features included in Pollster 2.0:
- Unlimited options: The first version of Pollster only allowed you to enter up to five options for your poll. Version 2.0 allows you configure the number of options you want to have available. The default is 10 but you can set it as high or as low as you want.
- Customizable option colors: Customize the colors used to render the results of your polls.
- Accounts and roles: Pollster 2.0 now supports the concept of accounts so that different users can use the same installation of Pollster. Administrators can create, delete, and edit users' accounts.
- Automatic update: Pollster 2.0 polls now update themselves automatically in order to reflect the most recent response at a configurable interval. Users can choose to manually update poll results so they don't have to reload the entire web page on which the poll is displayed.
- Database-friendly: The first version of Pollster only supported PostgreSQL and Microsoft Access out of the box; code changes were required to get the application to work with SQL Server. Although we still cannot support MySQL (because MySQL does not yet support subselects), changes to the database schema make transitions from Access to SQL Server much simpler than before.
- More web server–friendly: The first version of Pollster used HTTP authentication which was incompatible with some configurations of Windows and Microsoft Internet Information Services (IIS). Because Version 2.0 implements its own authentication model, it works consistently across all supported platforms and web servers.
- Browse past polls: Just because a poll is no longer active doesn't mean the data isn't important and relevant. Pollster 2.0 polls allow you to access and browse old, archived polls.
- Install anywhere: The first version of Pollster had to be installed in a directory called "pollster" in your web server's document root in order to work. Pollster is now more configurable so that you can it anywhere you want within your web root.
In case you missed DRK 4, these are some of the features that were available in Pollster 1.0, and are still available in the newest version:
- Poll status: Rather than deleting polls and losing valuable statistics, simply archive them by making them inactive.
- Restrict responses: Optionally prevent the same person from responding multiple times to the same poll.
- Export to Excel: Export your poll results to an Microsoft Excel spreadsheet to make sharing results simple.
Installing and Configuring Macromedia Pollster 2.0
You can make installing Macromedia Pollster 2.0 as straightforward or customized as you want.
Basic Installation
Here is the easiest and fastest way to get Pollster 2.0 up and running:
- Unzip the pollster.zip file.
- Move the pollster directory to your web server's document root. For instance, if your webroot is C:\\CFusionMX\wwwroot, you can install Pollster 2.0 like this: C:\\CFusionMX\wwwroot\pollster.
- Create a data source in the ColdFusion administrator called "pollster" that points to the Access database located in pollster\db.
- Go to http://localhost:8500/pollster/setup/index.cfm to create an account and start using Pollster 2.0.
The default Pollster 2.0 configuration assumes you are running ColdFusion on port 8500. If you are not using port 8500, you must remove the port number from the URL contained in the application.gateway variable in the Application.cfm file or change it to the port on which you are running ColdFusion.
Advanced Installation
There is a set of application-level variables located in Application.cfm that you can adjust in order to customize your installation and configuration of Macromedia Pollster 2.0. Below is a description of all the variables and how changing them affects the application.
| Variable Name | Description |
|---|---|
| dataSource | The name you give the Pollster 2.0 data source in the ColdFusion Administrator. |
| cfmPath | The path you should use to make requests to Pollster 2.0 ColdFusion pages, including the context root if your server requires one (only J2EE versions of ColdFusion sometimes require context roots). If your server does not require a context root, just point this to the directory where Pollster 2.0 is installed. |
| resourcePath | The path you should use to make requests to non-ColdFusion resources within the Pollster 2.0 application. This should be the same as the cfmPath variable but without the context root if your server requires one. If your server does not require a context root, this path should be exactly the same as the value for the cfmPath variable. |
| componentPath | The path to the Pollster 2.0 components. Only change this if you install Pollster in a directory other than the default "pollster" directory (see "Installing Pollster 2.0 In a Custom Location" below). |
| dateMask | The format for all dates in the application. |
| timeMask | The format for all times in the application. |
| gateway | The Flash Remoting gateway, as it is configured on your server. If you don't know what this is, use the default value. If your server requires a context root, edit this URL accordingly. |
| servicepath | The path to the component that handles Flash Remoting calls from the Flash poll. You shouldn't need to change this, even if you install Pollster outside its default installation directory. |
| updateInterval | The interval with which the Flash poll updates its data (in seconds). |
| lockTimeout | Pollster 2.0 uses some exclusive locks to protect the integrity of user account information. This value specifies the number of seconds that ColdFusion server waits to obtain a lock. You should not have to adjust this value. |
| optionNum | The maximum number of options that all polls created with Pollster can have. |
| optionColors | The colors that will be used to render the results of your polls, expressed as hexadecimals. You should always have no fewer colors defined than the maximum number of options any active poll has. |
Note: You can make changes to variables inside Application.cfm and update the application without having to restart the ColdFusion server. Simply make a request to any page within Pollster 2.0 with the query string parameter "flushInit=true" appended to it, like this:
http://localhost:8500/pollster/index.cfm?flushInit=true
This causes the code within the INIT tag inside Application.cfm to execute again, and the application to reinitialize itself dynamically.
Installing Pollster 2.0 in a Custom Location
To install Pollster 2.0 in a custom location, you need to edit the cfmPath, resourePath, and componentPath variables in Application.cfm. For instance, if you want to install Pollster in /myApps/pollster2 rather than /pollster, your configuration would look like this:
application.cfmPath = "/myApps/pollster2"; application.resourcePath = "/myApps/pollster2"; application.componentPath = "myApps.pollster2.components";
Remember that if your server requires a context root, include it in the value for the application.cfmPath and application.gateway variables. For instance, if your context root were "cfusion," your configuration should look like this:
application.cfmPath = "/cfusion/myApps/pollster2"; application.gateway = "http://localhost/cfusion/flashservices/gateway";
Note about ColdFusion MX 6.1: Unix users must use ColdFusion MX 6.1 in order for Pollster 2.0 to work properly because Pollster 2.0 uses mixed-case component names, which are not supported by ColdFusion MX releases prior to 6.1. If you are using an older release, either create all lowercase symbolic links to the mixed-case component names (use links rather than renaming the components) or, better yet, upgrade to ColdFusion MX 6.1. It's free!
Pollster 2.0's database transactions will not be completely secure on ColdFusion releases prior to ColdFusion MX 6.1. Although the application still works, transactions will not be rolled back properly in the event of an error.
Using the Macromedia Pollster 2.0 Administration Interface
Pollster's administration interface is straightforward and easy to use. With it you can create, edit, view, and delete polls, as well as view statistics on poll results, generate tags to embed polls in your website, and export poll data in Excel format. The interface is pretty intuitive; you should be able to create a couple of test polls in no time.
When you create a poll, check the Restricted option. Restricting a poll makes Pollster accept only a single response from a particular client per poll. In other words, responders to a poll cannot submit additional responses to that particular poll. However, they can submit responses to other Pollster polls.
Note: Pollster uses a hash (encoded numeric representation) of users' IP addresses, browser types, and versions, and an arbitrary unique ID stored in a cookie to determine if a particular client has previously responded to a specific poll. Although this method is fairly reliable, it is not 100 percent foolproof. Keep this in mind when you view poll results.
You can make an active or inactive poll. Inactive polls should not be deployed because the poll question and options cannot be viewed through the Flash interface; also, users cannot respond to inactive polls. However, inactivating a poll is a good way to prevent additional responses without deleting the poll.
Users who are administrators can create new accounts, delete accounts (and all of the user's polls, options, and responses), reset passwords, and grant other users administrative privileges.
Deploying Macromedia Pollster 2.0 Polls
There are two ways you can deploy polls created with Pollster 2.0. The first method is to manually copy the code generated by the Pollster 2.0 administration interface and paste into your HTML page. The second and easier way is to install and use the Pollster 2.0 Dreamweaver extension included on DRK Volume 5.
Once you create a poll in the Pollster administration interface, insert it in a web page using the Polling Application Object Extension for Dreamweaver MX included on this DRK. This extension inserts the required HTML to display poll.swf.
To install the Polling Application Object Extension, you must install Macromedia Extension Manager. If you have not done so yet, you can get it from the Macromedia website. Before you install any extension, make sure you first close Dreamweaver MX.
Install the components by double-clicking PollingAppObj.mxp. This opens the Macromedia Extension Manager, which installs the components for you automatically. You can also install the components by first opening the Macromedia Extension Manager, selecting File > Install Extension, and navigating to PollingAppObj.mxp.
Once you install the extension, you can access it by selecting Insert > Interactive Images > Poll or by selecting the Media tab on the Insert menu and clicking the poll icon. Save your web page first before using the extension to insert the poll.
To set the Polling Application dialog box options, specify the following settings:
- Poll ID is the unique ID generated by the Pollster administration interface. It must be 35 characters long.
- Flash Remoting Gateway Path is the URL that poll.swf uses to connect to and load data from the Flash Remoting gateway. The path should either be an absolute URL like "http://www.domain.com/flashservice/gateway" or start from the web root like " /flashservices/gateway". The default value for the path is "/flashremoting/gateway/".
- Polling Component Path is the URL that poll.swf uses to connect to, retrieve data from, and submit data to the ColdFusion component using Flash Remoting. The default value for the path is pollster.components.handlers.FlashHandler.
After these items are set, click OK.
After Dreamweaver inserts the HTML for poll.swf into the page and puts a copy of poll.swf in the same folder as the web page, you can either upload the page and poll.swf to your server immediately or continue working on the page.